home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / 1.098 / prof / sun4c.md / profInt.h < prev    next >
C/C++ Source or Header  |  1991-05-24  |  2KB  |  84 lines

  1. /*
  2.  * profInt.h --
  3.  *
  4.  *    Internal declarations of the profile module.
  5.  *
  6.  * Copyright 1986 Regents of the University of California
  7.  * All rights reserved.
  8.  *
  9.  *
  10.  * $Header: /sprite/src/kernel/prof/sun4.md/RCS/profInt.h,v 1.3 90/11/08 10:35:20 rab Exp $ SPRITE (Berkeley)
  11.  */
  12.  
  13. #ifndef _PROFINT
  14. #define _PROFINT
  15.  
  16. /* procedures */
  17.  
  18. extern void __mcount _ARGS_((unsigned int callerPC, unsigned int calleePC));
  19.  
  20. /*
  21.  * A histogram of PC samples is kept for use by gprof.
  22.  * Each sample is a counter that gets incremented when
  23.  * the PC is in the range for the counter.  The PC's are
  24.  * clustered in groups of 1, 2, 4, 8... values and there
  25.  * is a counter for each group.  A groupsize of 1 means there
  26.  * is a counter for every possible PC value.  The even sizes of
  27.  * the groups lets us generate the index into the array of counters
  28.  * by shifting.  (The about to shift also takes into account the
  29.  * size of an instruction, it averages that to two bytes!)
  30.  */
  31.  
  32. #define PROF_PC_GROUP_SIZE    2
  33. #define PROF_GROUP_SHIFT    1
  34. #ifdef NOTDEF
  35. /* why is this in more than one place? */
  36. #define PROF_ARC_GROUP_SHIFT    4
  37. #endif
  38. #define PROF_INSTR_SIZE_SHIFT    2
  39. #define PROF_PC_SHIFT        (PROF_GROUP_SHIFT + PROF_INSTR_SIZE_SHIFT)
  40.  
  41. /*
  42.  * Storage is set aside to hold call graph arc execution counts.
  43.  * The number of arcs stored is the number of instruction in the
  44.  * kernel divided by CALL_RATIO. ie. This represents the proportion
  45.  * of the instructions that are calls.
  46.  */
  47.  
  48. #define PROF_CALL_RATIO     8
  49.  
  50. /*
  51.  * A raw call graph arc just includes the callee's PC and the number of
  52.  * times the arc was executed.  The caller of the arc is the index of the
  53.  * arcIndex index shifted by PROF_ARC_SHIFT.
  54.  */
  55. #define PROF_ARC_GROUP_SHIFT    2
  56. #define PROF_ARC_SHIFT        (PROF_ARC_GROUP_SHIFT + PROF_INSTR_SIZE_SHIFT)
  57. typedef struct ProfRawArc {
  58.     int    calleePC;
  59.     int    count;
  60.     struct ProfRawArc *link;
  61. } ProfRawArc;
  62.  
  63. typedef struct ProfArc {
  64.     int    callerPC;
  65.     int    calleePC;
  66.     int    count;
  67. } ProfArc;
  68.  
  69. extern int        profArcListSize;
  70. extern ProfRawArc    *profArcList;
  71. extern ProfRawArc    *profArcListFreePtr;
  72. extern ProfRawArc    *profArcListEndPtr;
  73.  
  74. extern int        profArcIndexSize;
  75. extern ProfRawArc    **profArcIndex;
  76.  
  77. /*
  78.  * An of/off switch for profiling.
  79.  */
  80.  
  81. extern Boolean profEnabled;
  82.  
  83. #endif /* _PROFINT */
  84.